TOOL_PROP_SERIAL,
TOOL_PROP_TOOL_TYPE,
TOOL_PROP_AXES,
+ TOOL_PROP_HARDWARE_ID,
N_TOOL_PROPS
};
case TOOL_PROP_AXES:
tool->tool_axes = g_value_get_flags (value);
break;
+ case TOOL_PROP_HARDWARE_ID:
+ tool->hw_id = g_value_get_uint64 (value);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
case TOOL_PROP_AXES:
g_value_set_flags (value, tool->tool_axes);
break;
+ case TOOL_PROP_HARDWARE_ID:
+ g_value_set_uint64 (value, tool->hw_id);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
GDK_TYPE_AXIS_FLAGS, 0,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY);
+ tool_props[TOOL_PROP_HARDWARE_ID] = g_param_spec_uint64 ("hardware-id",
+ "Hardware ID",
+ "Hardware ID",
+ 0, G_MAXUINT64, 0,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY);
g_object_class_install_properties (object_class, N_TOOL_PROPS, tool_props);
}
return tool->serial;
}
+/**
+ * gdk_device_tool_get_hardware_id:
+ * @tool: a #GdkDeviceTool
+ *
+ * Gets the hardware ID of this tool, or 0 if it's not known. When
+ * non-zero, the identificator is unique for the given tool model,
+ * meaning that two identical tools will share the same @hardware_id,
+ * but will have different serial numbers (see gdk_device_tool_get_serial()).
+ *
+ * This is a more concrete (and device specific) method to identify
+ * a #GdkDeviceTool than gdk_device_tool_get_tool_type(), as a tablet
+ * may support multiple devices with the same #GdkDeviceToolType,
+ * but having different hardware identificators.
+ *
+ * Returns: The hardware identificator of this tool.
+ *
+ * Since: 3.22
+ **/
+guint64
+gdk_device_tool_get_hardware_id (GdkDeviceTool *tool)
+{
+ g_return_val_if_fail (tool != NULL, 0);
+
+ return tool->hw_id;
+}
+
/**
* gdk_device_tool_get_tool_type:
* @tool: a #GdkDeviceTool